﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
namespace Lawyer.Web.FileInfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtFileID.Text.Trim().Length==0)
			{
				strErr+="FileID不能为空！\\n";	
			}
			if(this.txtFileName.Text.Trim().Length==0)
			{
				strErr+="FileName不能为空！\\n";	
			}
			if(this.txtFileNote.Text.Trim().Length==0)
			{
				strErr+="FileNote不能为空！\\n";	
			}
			if(this.txtFileURL.Text.Trim().Length==0)
			{
				strErr+="FileURL不能为空！\\n";	
			}
			if(this.txtLawyerID.Text.Trim().Length==0)
			{
				strErr+="LawyerID不能为空！\\n";	
			}
			if(this.txtArchiveID.Text.Trim().Length==0)
			{
				strErr+="ArchiveID不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtIsArchive.Text))
			{
				strErr+="IsArchive格式错误！\\n";	
			}
			if(this.txtCreatedBy.Text.Trim().Length==0)
			{
				strErr+="CreatedBy不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCreatedDate.Text))
			{
				strErr+="CreatedDate格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string FileID=this.txtFileID.Text;
			string FileName=this.txtFileName.Text;
			string FileNote=this.txtFileNote.Text;
			string FileURL=this.txtFileURL.Text;
			string LawyerID=this.txtLawyerID.Text;
			string ArchiveID=this.txtArchiveID.Text;
			int IsArchive=int.Parse(this.txtIsArchive.Text);
			string CreatedBy=this.txtCreatedBy.Text;
			DateTime CreatedDate=DateTime.Parse(this.txtCreatedDate.Text);

			Lawyer.Model.FileInfo model=new Lawyer.Model.FileInfo();
			model.FileID=FileID;
			model.FileName=FileName;
			model.FileNote=FileNote;
			model.FileURL=FileURL;
			model.LawyerID=LawyerID;
			model.ArchiveID=ArchiveID;
			model.IsArchive=IsArchive;
			model.CreatedBy=CreatedBy;
			model.CreatedDate=CreatedDate;

			Lawyer.BLL.FileInfo bll=new Lawyer.BLL.FileInfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
